<template>
  <n-avatar :src="srcComputed"  :size="size" r></n-avatar>
</template>

<script setup lang="ts">

import {imageUrlPrefix} from '~/settings'
import {computed} from "vue";
import {checkURL} from "@/utils";

const prefix = imageUrlPrefix
const props = defineProps({
  src: {
    type: String,
    default: 'https://zzjtpp.top/blogAPI/upload/blog/images/2023-05-09/zbce4hi8f5.jpg'
  },
  size:{
    type:Number,
    default:48
  }
})

const srcComputed = computed(() => {
  if(checkURL(props.src)){
    return props.src
  }else if(props.src){
    return prefix+props.src
  }else{
    return 'https://zzjtpp.top/blogAPI/upload/blog/images/2023-05-09/zbce4hi8f5.jpg'
  }
})

</script>

<style scoped>

</style>